package com.qtcm.nas.cxm.yushouka.web;

import com.qtcm.nas.cxm.yushouka.pojo.*;
import com.qtcm.nas.cxm.yushouka.service.IYuShouService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.Date;
import java.util.List;

@  Controller
@RequestMapping("/admin")
public class YuShouKaController {
    @Autowired
    private IYuShouService yuShouService;
    @RequestMapping("/findCard")
    public String findCard( Model model){
        List<CardTwo> cardOneOrCardTwo = yuShouService.findCardOneOrCardTwo("%"+"储值"+ "%");
        List<CardOne> one = yuShouService.findOne();
        List<CardTwo> nian = yuShouService.findNian("%" + "年" + "%");
        List<Employee_ys> allYg = yuShouService.findAllYg();
        List<MemberShip_Form_ys> hy = yuShouService.findHy();
        System.out.println(nian);
        System.out.println(one);
        System.out.println(cardOneOrCardTwo);
        System.out.println(allYg);
        System.out.println(hy);
        model.addAttribute("one",one);
        model.addAttribute("card",cardOneOrCardTwo);
        model.addAttribute("nian",nian);
        model.addAttribute("all",allYg);
        model.addAttribute("hy",hy);
        return "presell_Card";
    }
    @RequestMapping("/addChard")
    public String addChard(Pre_Sale_Card_Table preSaleCardTable){
        preSaleCardTable.setB_date(new Date());
        System.out.println(preSaleCardTable.toString());
        yuShouService.addChard(preSaleCardTable);
        return "index";
    }
}
